package process
import (
	"fmt"
	"manyuser/common/message"
	"encoding/json"
	"manyuser/client/utils"
)

type SmsProcess struct{

}
//群聊消息
func(this *SmsProcess)SendGroupMes(content string)(err error){
	var mes message.Message
	mes.Type=message.SmsMesType

	var smsMes message.SmsMes
	smsMes.Content=content
	smsMes.UserId=CurUser.UserId
	smsMes.UserStatus=CurUser.UserStatus

	data,err:=json.Marshal(smsMes)
	if err!=nil{
		fmt.Println("json.Marshal(smsMes) wrong",err.Error())
		return
	}
	mes.Data=string(data)
	data,err=json.Marshal(mes)
	if err!=nil{
		fmt.Println("json.Marshal(mes) wrong",err.Error())
		return
	}
	err=(&utils.Transfer{Conn:CurUser.Conn,}).WritePkg(data)
	if err!=nil{
		fmt.Println("&utils.Transfer{Conn,CurUser.Conn,}.WritePkg(data) wrong",err.Error())
		return
	}
	return
}

